1. Field of the Invention
The present invention relates to a microcomputer in which data (the contents) of a program loaded in a read-only memory ROM developed or formed therein by use of a mask can be arbitrarily modified for execution thereof and to a microcomputer program modifying apparatus which produces modified program data for arbitrary program data in the read-only memory.
Moreover, the present invention relates to a microcomputer being incorporated in an electronic apparatus and having an integral ROM developed therein according to a mask, particularly to a microcomputer having no need to be separated nor removed from the apparatus for evaluation and test thereof.
2. Description of the Related Arts
Heretofore, a microcomputer formed in one chip generally includes, as shown in FIG. 35, a program memory PM in which programs are written, a program counter PC for sequentially specifying addresses of the program memory in accordance with a system clock signal, and an instruction decoder ID for transforming an instruction outputted from the program memory into an executable instruction signal.
Referring now to FIG. 35, description will be given of an example of a conventional one-chip microcomputer.
The one-chip microcomputer includes a program counter 602 for producing an output 652 representing an address, a program memory 604 fixedly fabricated therein by using a mask for receiving the output 652 to thereby generate an output 655 corresponding thereto, an instruction register 606 for receiving the output 655 to temporarily keep the output 655 therein and for thereafter delivering an output 656 when necessary, and an instruction decoder (ID) 608 for receiving the output 656 and converting the output 656 into an instruction signal to be executed.
Description will next be given of the operation of the microcomputer configured in one chip as above.
The program counter 602 having counted system clock signals, not shown, supplies the output 652, and then the program memory 604 sends as the output 655 data recorded at an address specified by the received output 652 to the instruction register 606, which in turn temporarily keeps the output 655 therein. At a proper timing thereafter, the register 606 feeds as the output 656 therefrom the stored signal to the instruction decoder 608. The decoder 608 then converts the output 656 into an executable instruction signal. The instruction signal also controls the internal operation of the one-chip microcomputer. The operations above are repeatedly accomplished to achieve the operation of the microcomputer.
As the program memory (PM), there is commonly employed a mask ROM (developed through a mask). The mask ROM is loaded with a program in a manufacturing process by the producer of the ROM; namely, it is impossible for the user to rewrite a desired program therein.
Moreover, after the one-chip microcomputer is produced, when a bug is found in the programs written in the mask ROM or when a portion of the program is preferable to be modified, the ROM mask pattern is required to be changed to thereby achieve the production process of the improved integrated circuit. Consequently, several months are required before the one-chip microcomputer thus modified is delivered to the user.
Under the conditions above, in order to solve the problems, there has been proposed in the JP-A-3-33926 a method in which a non-volatile memory is integrally disposed in a one-chip microcomputer to rewrite data therein, thereby modifying the program data.
According to this method, the user beforehand stores change address data and change instruction codes for modification in a non-volatile memory of the one-chip computer so that when an address outputted from the program counter matches the change address data specified for modification in the non-volatile memory, the change instructions are executed being decoded from the change instruction codes stored in the address of the memory addressed by the change address data.
FIG. 36 shows an example of a one-chip microcomputer including therein a non-volatile memory as described in the JP-A-3-33926.
The microcomputer of FIG. 36 includes, in addition to the components of the microcomputer shown in FIG. 35, an electrically writable non-volatile memory 610 for receiving the output 652 from the program counter 602 as an address when the program memory 604 developed by use of a mask receives the outputs 652 and a selector 612 for conducting a selection between an output from the non-volatile memory 610 and an output from the program memory 654 to supply the selected output to the instruction decoder 608.
In the non-volatile memory 610, there are beforehand stored change address data denoting addresses of the program memory 604 where program data to be rewritten are stored and change instruction codes to be replaced to the program data stored at the addresses.
When the address specified by the output 652 from the program counter 602 coincides with the change address data stored in the non-volatile memory 610, the selector 612 ignores the data of the program memory 604 and provides the change instruction codes from the non-volatile memory 610 to the instruction decoder 608.
In the one-chip microcomputer described above, program data developed through a mask therein can be replaced with arbitrary program data (change instruction codes) at each desired address. Consequently, in a case where a bug is found in the program of a mass-produced one-chip microcomputer or where a portion of the program is to be modified, the program can be altered without modifying the mask ROM. As a result, the production process needs not to be interrupted for the program modification.
However, in the one-chip microcomputer described in the JP-A-3-33926, there is required a process of integrally fabricating a non-volatile memory section such as an E.sup.2 PROM or EPROM in the microcomputer.
In consequence, the manufacturing process becomes complicated and necessitates a large number of steps, leading to reduction of yielding. Due to the lowered yielding and necessity of a long period of time for production, the cost of the one-chip microcomputer soars.
Moreover, since change address data and change instruction codes which may be possibly changed in future are required to be entirely stored in the non-volatile memory in advance, the capacity of the memory is necessarily increased. However, the capacity of the memory is not always completely used up, and hence there disadvantageously appear memory areas left unused therein.
To overcome this problem, Miyazawa has proposed in the JP-A-3-186927 an apparatus for changing programs of a microcomputer. The apparatus is a microcomputer system including an ROM, a program change RAM, a one-chip microcomputer operating according to program instructions stored in the ROM, and a non-volatile memory connected via a signal line to the one-chip microcomputer.
In the non-volatile memory, there are beforehand stored change addresses and change instruction codes for changing the program in the ROM. The one-chip microcomputer receives, according to a program including a plurality of instruction codes executed immediately following a reset operation at the power-on thereof, the change addresses and the instruction codes from the non-volatile memory to store the data in the program change RAM. The change address is then compared with the address denoted by the program counter. When these items are identical to each other, the stored instruction code is executed.
In the microcomputer system using the program change apparatus above, the non-volatile memory need not to be integrally formed in the one-chip microcomputer fabricated in the CMOS process. Consequently, the cost of the microcomputer system can be decreased.
However, since it is necessary to store in the program change RAM all data items including change addresses and change instruction codes which may possibly be altered in the operation later, the memory is required to have a capacity coping with the maximum volume of data items above. However, due to restriction of the area of the IC chip, the capacity of the RAM is also limited in many cases. Consequently, when the data items for modifications exceed the RAM capacity, the user is required to omit some modifications.
Moreover, in the conventional one-chip microcomputer, although a simple program data replacement can be achieved only at same addresses of the program fabricated by use of a mask, it has been difficult to insert therein a different number of instructions.
In an actual one-chip microcomputer, the program change or modification includes instruction insertion as well as data replacement. This insertion requirement, however, cannot be coped with by the conventional method.
Furthermore, when a trouble such as an erroneous operation occurs in the electronic apparatus in which the microcomputer is incorporated, it is impossible, with the one-chip microcomputer being incorporated in the apparatus, to implement the program modification as effective means for clarifying or deciding the cause of trouble. Consequently, a long period of time and a large amount of human work are required to examine and to determine the trouble, which leads to a problem that the reliable control of the electronic apparatus cannot be satisfactorily achieved.